import Document, { Html, Head, Main, NextScript } from 'next/document';

function WithDocument() {
  return (
    <Html>
      <Head>
        <script src="/serviceWorkerRegister.js" defer></script>
        <link rel="icon" href="/favicon.ico" />
      </Head>
      <body>
        <Main />
        <NextScript />
      </body>
    </Html>
  );
}

WithDocument.getInitialProps = async (ctx: any) => {
  const initialProps = await Document.getInitialProps(ctx);
  return { ...initialProps };
};

export default WithDocument;